home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 2510.ZIP / TRSOURCE.EXE / FILESIZE.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  764b  |  40 lines

  1. /*********
  2. *
  3. * FILESIZE.C
  4. *
  5. * by Ralph Davis
  6. *
  7. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  8. *
  9. *     SYNTAX:  FILESIZE( <expC> )
  10. *
  11. * PARAMETERS:  <expC> = filespec, optionally including
  12. *                       drive, path, filename, and extension.
  13. *
  14. *    RETURNS:  Size of file in bytes.
  15. *
  16. *********/
  17.  
  18. #include "trlib.h"
  19.  
  20. TRTYPE filesize()
  21. {
  22.    char *filename = _parc(1);
  23.    
  24.    if (PCOUNT == 1 && ISCHAR(1))
  25.    {
  26.       /* No wildcards in filename */
  27.       
  28.       if ((_tr_stpchr( filename, (char) '*') == 0L) 
  29.            && (_tr_stpchr( filename, (char ) '?') == 0L))
  30.          _retnl( _tr_fs( filename ) );
  31.       else
  32.          _retnl(ERRORNEGL);
  33.    }
  34.    else
  35.       _retnl(ERRORNEGL);
  36.    
  37.    return;
  38. }
  39.  
  40.